package org.fangzz.cameramgr.cameramonitor.dto;

import org.fangzz.cameramgr.cameramonitor.model.Camera;

import java.util.ArrayList;
import java.util.List;

public class CameraSummary {

    private Integer id;

    private StoreSummary store;

    private String cameraName;

    private String live;  //直播地址

    private String record; //录播地址

    private String rtspStreamAddress; //rtsp地址

    private String rtmpStreamAddress; //rtmp地址

    private Integer usingAmount;   //使用统计

    private String area;

    private boolean isAlive;


    public static CameraSummary convert(Camera camera){
        CameraSummary cameraSummary = new CameraSummary();
        cameraSummary.setArea(camera.getArea());
        cameraSummary.setId(camera.getId());
        cameraSummary.setCameraName(camera.getName());
        cameraSummary.setLiveAddress(camera.getLive());
        cameraSummary.setRecordAddress(camera.getRecord());
        cameraSummary.setStore(StoreSummary.convert(camera.getStore()));
        cameraSummary.setRtspStreamAddress(camera.getRtspStreamAddress());
        cameraSummary.setRtmpStreamAddress(camera.getRtmpStreamAddress());
        cameraSummary.setUsingAmount(camera.getUsingAmount());
        cameraSummary.setAlive(camera.isAlive());
        return cameraSummary;
    }

    public static List<CameraSummary> convert(List<Camera> storeList){
        List<CameraSummary> cameraSummaries = new ArrayList<>();
        storeList.stream().forEach(Camera->{
            cameraSummaries.add(CameraSummary.convert(Camera));
        });
        return cameraSummaries;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public StoreSummary getStore() {
        return store;
    }

    public void setStore(StoreSummary store) {
        this.store = store;
    }

    public String getName() {
        return cameraName;
    }

    public void setCameraName(String cameraName) {
        this.cameraName = cameraName;
    }

    public String getLive() {
        return live;
    }

    public void setLiveAddress(String liveAddress) {
        this.live = liveAddress;
    }

    public String getRecord() {
        return record;
    }

    public void setRecordAddress(String recordAddress) {
        this.record = recordAddress;
    }

    public String getRtspStreamAddress() {
        return rtspStreamAddress;
    }

    public void setRtspStreamAddress(String rtspStreamAddress) {
        this.rtspStreamAddress = rtspStreamAddress;
    }

    public String getRtmpStreamAddress() {
        return rtmpStreamAddress;
    }

    public void setRtmpStreamAddress(String rtmpStreamAddress) {
        this.rtmpStreamAddress = rtmpStreamAddress;
    }

    public Integer getUsingAmount() {
        return usingAmount;
    }

    public void setUsingAmount(Integer usingAmount) {
        this.usingAmount = usingAmount;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public boolean getAlive() {
        return isAlive;
    }

    public void setAlive(boolean alive) {
        isAlive = alive;
    }
}
